home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual dBase v5.5 / SAMPLES2.PAK / ANIMVCR.WFM < prev    next >
Encoding:
Text File  |  1995-07-18  |  8.3 KB  |  334 lines

  1. *******************************************************************************
  2. *  PROGRAM:      Animvcr.wfm
  3. *
  4. *  WRITTEN BY:   Borland Samples Group
  5. *
  6. *  DATE:         6/95
  7. *
  8. *  UPDATED:
  9. *
  10. *  REVISION:     $Revision:   1.4  $
  11. *
  12. *  VERSION:      Visual dBASE
  13. *
  14. *  DESCRIPTION:  This program shows the ability of Visual dBASE to traverse a
  15. *                table and display its contents in a form, using custom
  16. *                controls.
  17. *
  18. *  PARAMETERS:   None
  19. *
  20. *  CALLS:        Buttons.cc      (Custom Controls file)
  21. *                Animals.qbe     (View of table -- you can also use Animsql.qbe,
  22. *                                                  which uses local SQL to
  23. *                                                  accomplish the same tasks)
  24. *
  25. *  USAGE:        DO Animvcr.wfm
  26. *
  27. ********************************************************************************
  28. create session
  29. set talk off
  30. set ldCheck off
  31. shell(.F.)
  32. _app.speedbar = .F.
  33.  
  34. ** END HEADER -- do not remove this line*
  35. * Generated on 06/23/95
  36. *
  37. parameter bModal
  38. local f
  39. f = new ANIMVCRFORM()
  40. if (bModal)
  41.    f.mdi = .F. && ensure not MDI
  42.    f.ReadModal()
  43. else
  44.    f.Open()
  45. endif
  46. CLASS ANIMVCRFORM OF FORM
  47.    Set Procedure To &_dbwinhome.samples\BUTTONS.CC additive
  48.    Set Procedure To &_dbwinhome.custom\VCR.CC additive
  49.    this.OnOpen = CLASS::ONOPEN
  50.    this.OnClose = CLASS::ONCLOSE
  51.    this.View = "ANIMALS.QBE"
  52.    this.Text = "Animals"
  53.    this.OnNavigate = CLASS::ONNAVIGATE
  54.    this.Left = 20
  55.    this.Top = 0
  56.    this.Height = 13.1875
  57.    this.Width = 63.666
  58.    this.OnSize = CLASS::ONSIZE
  59.    this.Maximize = .F.
  60.    this.Minimize = .F.
  61.    this.ColorNormal = "BtnFace"
  62.  
  63.    DEFINE RECTANGLE INFORECTANGLE OF THIS;
  64.        PROPERTY;
  65.          FontSize 6.5,;
  66.          BorderStyle 1,;
  67.          Text "",;
  68.          MousePointer 3,;
  69.          Left 0.1973,;
  70.          Top 0.0977,;
  71.          Height 13.0273,;
  72.          Width 63.1357,;
  73.          ColorNormal "BtnFace"
  74.  
  75.    DEFINE TEXT TITLETEXT OF THIS;
  76.        PROPERTY;
  77.          FontName "Times New Roman",;
  78.          FontSize 22,;
  79.          Text "Animals of the World",;
  80.          Alignment 4,;
  81.          Left 1,;
  82.          Top 0.5,;
  83.          Height 1.5625,;
  84.          Width 61.666,;
  85.          FontBold .F.,;
  86.          ColorNormal "R/BtnFace"
  87.  
  88.    DEFINE TEXT NAMETEXT OF THIS;
  89.        PROPERTY;
  90.          FontName "Arial",;
  91.          FontSize 10,;
  92.          FontItalic .T.,;
  93.          Text "Name",;
  94.          Alignment 5,;
  95.          Left 2,;
  96.          Top 3.2344,;
  97.          Height 1.3906,;
  98.          Width 7,;
  99.          FontBold .F.,;
  100.          ColorNormal "B/BtnFace"
  101.  
  102.    DEFINE ENTRYFIELD NAMEENTRY OF THIS;
  103.        PROPERTY;
  104.          Enabled .F.,;
  105.          FontName "Arial",;
  106.          FontSize 10,;
  107.          ColorHighLight "N/GB+",;
  108.          DataLink "NAME",;
  109.          Left 10.8311,;
  110.          Top 3.2344,;
  111.          Height 1.3906,;
  112.          Width 16.502,;
  113.          ColorNormal "N/GB+"
  114.  
  115.    DEFINE TEXT SIZETEXT OF THIS;
  116.        PROPERTY;
  117.          FontName "Arial",;
  118.          FontSize 10,;
  119.          FontItalic .T.,;
  120.          Text "Size",;
  121.          Alignment 5,;
  122.          Left 2,;
  123.          Top 4.7637,;
  124.          Height 1.2988,;
  125.          Width 7,;
  126.          FontBold .F.,;
  127.          ColorNormal "B/BtnFace"
  128.  
  129.    DEFINE ENTRYFIELD SIZEENTRY OF THIS;
  130.        PROPERTY;
  131.          Enabled .F.,;
  132.          FontName "Arial",;
  133.          FontSize 10,;
  134.          ColorHighLight "N/GB+",;
  135.          DataLink "SIZE",;
  136.          Left 10.8311,;
  137.          Top 4.7637,;
  138.          Height 1.2988,;
  139.          Width 5.002,;
  140.          ColorNormal "N/GB+"
  141.  
  142.    DEFINE TEXT WEIGHTTEXT OF THIS;
  143.        PROPERTY;
  144.          FontName "Arial",;
  145.          FontSize 10,;
  146.          FontItalic .T.,;
  147.          Text "Weight",;
  148.          Alignment 5,;
  149.          Left 2,;
  150.          Top 6.2344,;
  151.          Height 1.3906,;
  152.          Width 7,;
  153.          FontBold .F.,;
  154.          ColorNormal "B/BtnFace"
  155.  
  156.    DEFINE ENTRYFIELD WEIGHTENTRY OF THIS;
  157.        PROPERTY;
  158.          Enabled .F.,;
  159.          FontName "Arial",;
  160.          FontSize 10,;
  161.          ColorHighLight "N/GB+",;
  162.          DataLink "WEIGHT",;
  163.          Left 10.8311,;
  164.          Top 6.2344,;
  165.          Height 1.3906,;
  166.          Width 5.002,;
  167.          ColorNormal "N/GB+"
  168.  
  169.    DEFINE TEXT AREATEXT OF THIS;
  170.        PROPERTY;
  171.          FontName "Arial",;
  172.          FontSize 10,;
  173.          FontItalic .T.,;
  174.          Text "Area",;
  175.          Alignment 5,;
  176.          Left 2,;
  177.          Top 7.7637,;
  178.          Height 1.2988,;
  179.          Width 7,;
  180.          FontBold .F.,;
  181.          ColorNormal "B/BtnFace"
  182.  
  183.    DEFINE ENTRYFIELD AREAENTRY OF THIS;
  184.        PROPERTY;
  185.          Enabled .F.,;
  186.          FontName "Arial",;
  187.          FontSize 10,;
  188.          ColorHighLight "N/GB+",;
  189.          DataLink "AREA",;
  190.          Left 10.8311,;
  191.          Top 7.7637,;
  192.          Height 1.2988,;
  193.          Width 24.335,;
  194.          ColorNormal "N/GB+"
  195.  
  196.    DEFINE RECTANGLE IMAGERECT OF THIS;
  197.        PROPERTY;
  198.          BorderStyle 2,;
  199.          Text "",;
  200.          Left 36.5,;
  201.          Top 3.0977,;
  202.          Height 9.5898,;
  203.          Width 26.166,;
  204.          ColorNormal "BtnFace"
  205.  
  206.    DEFINE IMAGE ANIMALIMAGE OF THIS;
  207.        PROPERTY;
  208.          Left 36.6641,;
  209.          Top 3.1475,;
  210.          Height 9.415,;
  211.          Width 25.6689,;
  212.          DataSource "BINARY BMP"
  213.  
  214.    DEFINE CLOSEBUTTON CLOSEANIMALSBUTTON OF THIS;
  215.        PROPERTY;
  216.          SpeedTip "Close this form",;
  217.          Text "",;
  218.          Left 31,;
  219.          Top 11.3125,;
  220.          Default .T.,;
  221.          Height 1.4375,;
  222.          Width 4,;
  223.          Group .T.,;
  224.          SpeedBar .T.
  225.  
  226.    DEFINE SAMPLEINFOBUTTON ANIMVCRINFOBUTTON OF THIS;
  227.        PROPERTY;
  228.          Text "",;
  229.          Left 59.5,;
  230.          Top 0.2979,;
  231.          Height 1.2021,;
  232.          Width 3.5,;
  233.          Group .T.
  234.  
  235.    DEFINE VCRBUTTONS VCRFIRSTBUTTON1 OF THIS;
  236.        PROPERTY;
  237.          Left 2,;
  238.          Top 11.25,;
  239.          Height 1.4375,;
  240.          Width 4
  241.  
  242.    PROCEDURE OnOpen
  243.    ****************************************************************************
  244.  
  245.    *** Do calculations in another workarea so form is not affected
  246.    use animals again in select() order name alias temp
  247.    go bottom in temp
  248.    form.lastRec = recno("temp")
  249.    go top in temp
  250.    form.firstRec = recno("temp")
  251.    use in temp
  252.    ***
  253.  
  254.    form.animvcrInfoButton.sampleName = "Animvcr.wfm"
  255.    form.closeAnimalsButton.SetFocus()
  256.  
  257.  
  258.    ****************************************************************************
  259.  
  260.    PROCEDURE NEXT_OnClick
  261.  
  262.    * Go to next record.
  263.    ****************************************************************************
  264.  
  265.    NEXTBUTTON::OnClick()
  266.    if recno() = form.lastRec        && If on last record, move to prevButton
  267.       form.prevAnimalButton.setfocus()
  268.    endif
  269.  
  270.  
  271.    ****************************************************************************
  272.  
  273.    PROCEDURE PREV_OnClick
  274.  
  275.    * Go to previous record.
  276.    ****************************************************************************
  277.  
  278.    PREVBUTTON::OnClick()
  279.    if recno() = form.firstRec       && If on first record, move to nextButton
  280.       form.nextAnimalButton.setfocus()
  281.    endif
  282.  
  283.  
  284.    ****************************************************************************
  285.  
  286.    PROCEDURE OnNavigate
  287.  
  288.    * If animal has size > 10, change background color of the size entryfield
  289.    * to red.
  290.    ****************************************************************************
  291.  
  292.    if size > 10
  293.       form.sizeEntry.colornormal = "gb+/r"
  294.       form.statusmessage = "Animal has size > 10."
  295.    else
  296.       form.sizeEntry.colornormal = "n/gb+"
  297.       form.statusmessage = ""
  298.    endif
  299.  
  300.  
  301.    ****************************************************************************
  302.  
  303.    PROCEDURE OnSize ( SizeType, NewWidth, NewHeight )
  304.  
  305.    * Resize main form rectangle as the form is resized.
  306.    ****************************************************************************
  307.  
  308.    form.infoRectangle.height = max(NewHeight -.2, 0)
  309.    form.infoRectangle.width = max(NewWidth - .5, 0)
  310.  
  311.  
  312.    ****************************************************************************
  313.  
  314.    PROCEDURE OnClose
  315.  
  316.    * Clean up.
  317.    ****************************************************************************
  318.  
  319.    close procedure &_dbwinhome.samples\Buttons.cc, &_dbwinhome.custom\Vcr.cc
  320.  
  321.    _app.speedbar = .T.
  322.    shell(.T.)
  323.  
  324. ENDCLASS
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.